home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes reversed ƒ / Rescue Raiders reversed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.0 KB  |  79 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 5
  4. #define theWindowWidth (boundsRect.right-boundsRect.left)
  5. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  6.  
  7. pascal short RescueRaidersReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* One region in 8 parts.  Each part of the region either starts at a corner
  10.    or in the middle of a side and moves progressively counterclockwise until the
  11.    entire screen is filled. Named after a similar effect in the game Rescue
  12.    Raiders on the Apple ][e (now called Armor Alley™ on the Mac, but it doesn't
  13.    have this effect in it anymore). */
  14.    
  15. pascal short RescueRaidersReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  16. {
  17.     RgnHandle    curregion;
  18.     short            cx,cy,lastx,lasty;
  19.     short            BlockSize, VBlockSize;
  20.     
  21.     cx = theWindowWidth / 2;
  22.     cy = theWindowHeight / 2;
  23.     BlockSize=theWindowWidth/25;
  24.     VBlockSize=theWindowHeight/25;
  25.  
  26.     lastx=cx-BlockSize;
  27.     lasty=cy-VBlockSize;
  28.     curregion=NewRgn();
  29.     do
  30.     {
  31.         StartTiming();
  32.  
  33.         SetEmptyRgn(curregion);
  34.         MoveTo(cx,cy);
  35.         OpenRgn();
  36.             LineTo(lastx,0);
  37.             Line(BlockSize,0);
  38.             LineTo(theWindowWidth-lastx-BlockSize,theWindowHeight);
  39.             Line(BlockSize,0);
  40.             LineTo(cx,cy);
  41.             
  42.             LineTo(cx+lastx,0);
  43.             Line(BlockSize,0);
  44.             LineTo(cx-lastx-BlockSize,theWindowHeight);
  45.             Line(BlockSize,0);
  46.             LineTo(cx,cy);
  47.             
  48.             LineTo(theWindowWidth,lasty);
  49.             Line(0,VBlockSize);
  50.             LineTo(0,theWindowHeight-lasty-VBlockSize);
  51.             Line(0,VBlockSize);
  52.             LineTo(cx,cy);
  53.             
  54.             LineTo(theWindowWidth,cy+lasty);
  55.             Line(0,VBlockSize);
  56.             LineTo(0,cy-lasty-VBlockSize);
  57.             Line(0,VBlockSize);
  58.             LineTo(cx,cy);
  59.         CloseRgn(curregion);
  60.         OffsetRgn(curregion, boundsRect.left, boundsRect.top);
  61.         
  62.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  63.             &boundsRect, &boundsRect, 0, curregion);
  64.  
  65.         lastx-=BlockSize;
  66.         lasty-=VBlockSize;
  67.  
  68.         TimeCorrection(CorrectTime);
  69.     }
  70.     while (lastx>=0);
  71.     
  72.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  73.         &boundsRect, &boundsRect, 0, 0L);   /* in case we missed any bits */
  74.     
  75.     DisposeRgn(curregion);
  76.     
  77.     return 0;
  78. }
  79.